package service

import (
	"context"
	"github.com/cloudwego/hertz/pkg/app"
	"github.com/jinzhu/copier"
	stage "stage/hertz_gen/stage"
	"stageRpc/client"
	stageRpcModel "stageRpc/kitex_gen/stage"
)

type GetZoomInfoService struct {
	RequestContext *app.RequestContext
	Context        context.Context
}

func NewGetZoomInfoService(Context context.Context, RequestContext *app.RequestContext) *GetZoomInfoService {
	return &GetZoomInfoService{RequestContext: RequestContext, Context: Context}
}

func (h *GetZoomInfoService) Run(req *stage.Zoom) (resp *stage.Zoom, err error) {
	var zoom = stageRpcModel.Zoom{}
	if err = copier.Copy(&zoom, *req); err != nil {
		return nil, err
	}
	r, err := client.StageClient.GetZoomInfo(h.Context, &zoom)
	if err != nil {
		return nil, err
	}
	resp = new(stage.Zoom)
	if err = copier.Copy(resp, r); err != nil {
		return nil, err
	}
	return
}
